/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#ifndef __WIDGET_BASE_H__
#define __WIDGET_BASE_H__

#include "BuilderPrerequisites.h"
#include "BuilderUI.h"
#include "PQEngine.h"
#include "NumericTextEdit.h"

namespace PQBuilder
{
	/*Gui base class that will handle object events.
	*/
	class WidgetBase : 
		public QWidget,
		public PQEngine::Object
	{
	public:
		WidgetBase(QWidget *parent = 0);
		~WidgetBase();
	public:
		/*Must implement it when need react some happen
		*/
		void handleEvent(PQEngine::Event* evt);

		/*Note all widgets that inherit WidgetBase need to react select render property event.
		*/
		static void selectRenderProperty();

		inline virtual void OnGameObjectCreated(PQEngine::GameObject* object){}
		inline virtual void OnGameObjectDeleted(PQEngine::GameObject* object){}
		inline virtual void OnGameObjectSelected(PQEngine::GameObject* object){}
		inline virtual void OnGameObjectDeselected(PQEngine::GameObject* object){}

		inline virtual void OnComponentCreated(PQEngine::Component* component){}
		inline virtual void OnComponentDeleted(PQEngine::Component* component){}
		inline virtual void OnComponentAttached(PQEngine::Component* component){}
		inline virtual void OnComponentDetached(PQEngine::Component* component){}
		inline virtual void OnComponentUpdated(PQEngine::Component* component){}

		//
		inline virtual void OnRenderPropertySelected(){}
	private:
		static QVector<WidgetBase*> _widgets;
		int _widgetId;
	};
}
#endif
